<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
    <title>Reference</title>
    <link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>

<div id="container">

<div id="product">
	<div id="product_logo"></div>
	<div id="product_name"><big><b></b></big></div>
	<div id="product_description"></div>
</div> <!-- id="product" -->


<div id="main">


<!-- Menu -->

<div id="navigation">
<br/>
<h1>Duplex</h1>

<ul>
  <li><a href="../index.html">Index</a></li>
</ul>

<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>


<h2>Modules</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap'">
  <li><a href="../modules/Duplex.Application.html">Duplex.Application</a></li>
  <li><a href="../modules/Duplex.Applications.Effect.html">Duplex.Applications.Effect</a></li>
  <li><a href="../modules/Duplex.Applications.GridPie.html">Duplex.Applications.GridPie</a></li>
  <li><a href="../modules/Duplex.Applications.Hydra.html">Duplex.Applications.Hydra</a></li>
  <li><a href="../modules/Duplex.Applications.Instrument.html">Duplex.Applications.Instrument</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.GridLayout.html">Duplex.Applications.Keyboard.GridLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.HarmonicLayout.html">Duplex.Applications.Keyboard.Layouts.HarmonicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.IsomorphicLayout.html">Duplex.Applications.Keyboard.Layouts.IsomorphicLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.Layouts.PianoLayout.html">Duplex.Applications.Keyboard.Layouts.PianoLayout</a></li>
  <li><a href="../modules/Duplex.Applications.Keyboard.html">Duplex.Applications.Keyboard</a></li>
  <li><a href="../modules/Duplex.Applications.Matrix.html">Duplex.Applications.Matrix</a></li>
  <li><a href="../modules/Duplex.Applications.Metronome.html">Duplex.Applications.Metronome</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.Bindings.html">Duplex.Applications.MidiActions.Bindings</a></li>
  <li><a href="../modules/Duplex.Applications.MidiActions.html">Duplex.Applications.MidiActions</a></li>
  <li><a href="../modules/Duplex.Applications.Mixer.html">Duplex.Applications.Mixer</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_group.html">Duplex.Applications.Mlrx.Mlrx_group</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_note.html">Duplex.Applications.Mlrx.Mlrx_note</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_pos.html">Duplex.Applications.Mlrx.Mlrx_pos</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.Mlrx_track.html">Duplex.Applications.Mlrx.Mlrx_track</a></li>
  <li><a href="../modules/Duplex.Applications.Mlrx.html">Duplex.Applications.Mlrx</a></li>
  <li><a href="../modules/Duplex.Applications.Navigator.html">Duplex.Applications.Navigator</a></li>
  <li><a href="../modules/Duplex.Applications.NotesOnWheels.html">Duplex.Applications.NotesOnWheels</a></li>
  <li><a href="../modules/Duplex.Applications.PatternCursor.html">Duplex.Applications.PatternCursor</a></li>
  <li><a href="../modules/Duplex.Applications.PatternSequence.html">Duplex.Applications.PatternSequence</a></li>
  <li><a href="../modules/Duplex.Applications.Recorder.html">Duplex.Applications.Recorder</a></li>
  <li><a href="../modules/Duplex.Applications.Repeater.html">Duplex.Applications.Repeater</a></li>
  <li><a href="../modules/Duplex.Applications.Rotate.html">Duplex.Applications.Rotate</a></li>
  <li><a href="../modules/Duplex.Applications.StepSequencer.html">Duplex.Applications.StepSequencer</a></li>
  <li><a href="../modules/Duplex.Applications.SwitchConfiguration.html">Duplex.Applications.SwitchConfiguration</a></li>
  <li><a href="../modules/Duplex.Applications.TestPad.html">Duplex.Applications.TestPad</a></li>
  <li><a href="../modules/Duplex.Applications.TrackSelector.html">Duplex.Applications.TrackSelector</a></li>
  <li><a href="../modules/Duplex.Applications.Transport.html">Duplex.Applications.Transport</a></li>
  <li><a href="../modules/Duplex.Applications.UIButtonTest.html">Duplex.Applications.UIButtonTest</a></li>
  <li><a href="../modules/Duplex.Applications.XYPad.html">Duplex.Applications.XYPad</a></li>
  <li><a href="../modules/Duplex.Automation.html">Duplex.Automation</a></li>
  <li><a href="../modules/Duplex.Browser.html">Duplex.Browser</a></li>
  <li><a href="../modules/Duplex.BrowserProcess.html">Duplex.BrowserProcess</a></li>
  <li><a href="../modules/Duplex.Canvas.html">Duplex.Canvas</a></li>
  <li><a href="../modules/Duplex.CanvasPoint.html">Duplex.CanvasPoint</a></li>
  <li><a href="../modules/Duplex.ControlMap.html">Duplex.ControlMap</a></li>
  <li><a href="../modules/Duplex.Device.html">Duplex.Device</a></li>
  <li><a href="../modules/Duplex.Display.html">Duplex.Display</a></li>
  <li><strong>Duplex.Globals</strong></li>
  <li><a href="../modules/Duplex.Message.html">Duplex.Message</a></li>
  <li><a href="../modules/Duplex.MessageStream.html">Duplex.MessageStream</a></li>
  <li><a href="../modules/Duplex.MidiDevice.html">Duplex.MidiDevice</a></li>
  <li><a href="../modules/Duplex.OscClient.html">Duplex.OscClient</a></li>
  <li><a href="../modules/Duplex.OscDevice.html">Duplex.OscDevice</a></li>
  <li><a href="../modules/Duplex.OscVoiceMgr.html">Duplex.OscVoiceMgr</a></li>
  <li><a href="../modules/Duplex.Preferences.html">Duplex.Preferences</a></li>
  <li><a href="../modules/Duplex.ProcessSlicer.html">Duplex.ProcessSlicer</a></li>
  <li><a href="../modules/Duplex.RoamingDSP.html">Duplex.RoamingDSP</a></li>
  <li><a href="../modules/Duplex.Scheduler.html">Duplex.Scheduler</a></li>
  <li><a href="../modules/Duplex.StateController.html">Duplex.StateController</a></li>
  <li><a href="../modules/Duplex.UIButton.html">Duplex.UIButton</a></li>
  <li><a href="../modules/Duplex.UIButtonStrip.html">Duplex.UIButtonStrip</a></li>
  <li><a href="../modules/Duplex.UIComponent.html">Duplex.UIComponent</a></li>
  <li><a href="../modules/Duplex.UIKey.html">Duplex.UIKey</a></li>
  <li><a href="../modules/Duplex.UIKeyPressure.html">Duplex.UIKeyPressure</a></li>
  <li><a href="../modules/Duplex.UILabel.html">Duplex.UILabel</a></li>
  <li><a href="../modules/Duplex.UIPad.html">Duplex.UIPad</a></li>
  <li><a href="../modules/Duplex.UIPitchBend.html">Duplex.UIPitchBend</a></li>
  <li><a href="../modules/Duplex.UISlider.html">Duplex.UISlider</a></li>
  <li><a href="../modules/Duplex.UISpinner.html">Duplex.UISpinner</a></li>
  <li><a href="../modules/Duplex.WidgetHooks.html">Duplex.WidgetHooks</a></li>
  <li><a href="../modules/Duplex.WidgetKeyboard.html">Duplex.WidgetKeyboard</a></li>
  <li><a href="../modules/Duplex.html">Duplex</a></li>
  <li><a href="../modules/main.html">main</a></li>
</ul>

</div>

<div id="content">

<h1>Module <code>Duplex.Globals</code></h1>
<p>Various global constants, functions and methods for tracing output</p>
<p>
<ul>
    <li>To enable tracing of output, see TRACE() </li>
</ul>

</p>


<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#compare">compare (val1, val2, precision)</a></td>
	<td class="summary">compare two numbers with variable precision</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#table_compare">table_compare (t1, t2)</a></td>
	<td class="summary">quick'n'dirty table compare, compares values (not keys)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#table_count">table_count (t)</a></td>
	<td class="summary">count table entries, including mixed types</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#table_find">table_find (t, val)</a></td>
	<td class="summary">look for value within table</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#table_has_equal_values">table_has_equal_values (t)</a></td>
	<td class="summary">check if values are the same
 (useful for detecting if a color is tinted)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#split_filename">split_filename (filename)</a></td>
	<td class="summary">split_filename</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#replace_char">replace_char (pos, str, r)</a></td>
	<td class="summary">replace character in string</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#note_pitch_to_value">note_pitch_to_value (val)</a></td>
	<td class="summary">convert note-column pitch number into string value</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#value_to_midi_pitch">value_to_midi_pitch (str_val)</a></td>
	<td class="summary">interpret note-string
 some examples of input: C#5  C--1  C-1 C#-1
 note that wildcard will return a fixed octave (1)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#extract_cc_num">extract_cc_num (str_val)</a></td>
	<td class="summary">extract cc number from a parameter</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_playing_pattern">get_playing_pattern ()</a></td>
	<td class="summary">get<em>playing</em>pattern</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_master_track">get_master_track ()</a></td>
	<td class="summary">get<em>master</em>track</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_master_track_index">get_master_track_index ()</a></td>
	<td class="summary">get<em>master</em>track_index</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#send_track">send_track (send_index)</a></td>
	<td class="summary">get send track</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#get_color_average">get_color_average (color)</a></td>
	<td class="summary">get average from color</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#is_monochrome">is_monochrome (colorspace)</a></td>
	<td class="summary">check if colorspace is monochromatic</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#strip_channel_info">strip_channel_info (str)</a></td>
	<td class="summary">remove channel info from value-string</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#strip_note_info">strip_note_info (str)</a></td>
	<td class="summary">remove note info from value-string</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#has_note_info">has_note_info (str)</a></td>
	<td class="summary">remove note info from value-string</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#determine_track_type">determine_track_type (track_index)</a></td>
	<td class="summary">get the type of track: sequencer/master/send</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#round_value">round_value (num)</a></td>
	<td class="summary">round_value (from http://lua-users.org/wiki/SimpleRound)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#clamp_value">clamp_value (value, min_value, max_value)</a></td>
	<td class="summary">clamp_value: ensure value is within min/max</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#wrap_value">wrap_value (value, min_value, max_value)</a></td>
	<td class="summary">wrap_value: 'rotate' value within specified range
 (with a range of 0-127, a value of 150 will output 22</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#scale_value">scale_value (value, in_min, in_max, out_min, out_max)</a></td>
	<td class="summary">scale_value: scale a value to a range within a range</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#log_scale">log_scale (ceiling, val)</a></td>
	<td class="summary">logarithmic scaling within a fixed space</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#inv_log_scale">inv_log_scale (ceiling, val)</a></td>
	<td class="summary">inverse logarithmic scaling (exponential)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#fraction">fraction (val)</a></td>
	<td class="summary">return the fractional part of a number</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#is_whole_number">is_whole_number (n)</a></td>
	<td class="summary">check for whole number, using format()</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#sign">sign (x)</a></td>
	<td class="summary">determine the sign of a number</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#average">average (...)</a></td>
	<td class="summary">get average of supplied numbers</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#gcd">gcd (m, n)</a></td>
	<td class="summary">greatest common divisor</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#lcm">lcm (m, n)</a></td>
	<td class="summary">least common multiplier (2 args)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#least_common">least_common (t)</a></td>
	<td class="summary">find least common multiplier</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#TRACE">TRACE (vararg)</a></td>
	<td class="summary">TRACE impl</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#LOG">LOG (str)</a></td>
	<td class="summary">call this to avoid using "print" statements in source code</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#LOG_FILE">LOG_FILE (str)</a></td>
	<td class="summary">append text to log.txt in the tool's root folder
 (warning: this is slow! only use when examining startup sequence,
 before it is possible to view output in the console window)</td>
	</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#ORIENTATION">ORIENTATION</a></td>
	<td class="summary">(Enum) used for layout purposes</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#NOTE_ARRAY">NOTE_ARRAY</a></td>
	<td class="summary">Table of note names</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DEVICE_PROTOCOL">DEVICE_PROTOCOL</a></td>
	<td class="summary">(Enum)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DEVICE_MESSAGE">DEVICE_MESSAGE</a></td>
	<td class="summary">(Enum)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#DEVICE_EVENT">DEVICE_EVENT</a></td>
	<td class="summary">(Enum) the type of event (pressed, held etc.)</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#PARAM_MODE">PARAM_MODE</a></td>
	<td class="summary">(Enum) valid <code>mode</code> attributes for <Param> nodes</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#INPUT_TYPE">INPUT_TYPE</a></td>
	<td class="summary">(Enum) valid <a href="http://www.lua.org/manual/5.1/manual.html#pdf-type">type</a>  attributes for <Param> nodes</td>
	</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
	<tr>
	<td class="name" nowrap><a href="#MODULE_PATH">MODULE_PATH</a></td>
	<td class="summary">The main folder</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#LOWER_NOTE">LOWER_NOTE</a></td>
	<td class="summary">Lowest possible note</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#UPPER_NOTE">UPPER_NOTE</a></td>
	<td class="summary">Highest possible note</td>
	</tr>
	<tr>
	<td class="name" nowrap><a href="#RENOISE_DECIBEL">RENOISE_DECIBEL</a></td>
	<td class="summary">Decibel constant</td>
	</tr>
</table>

<br/>
<br/>


    <h2><a name="Functions"></a>Functions</h2>
    <dl class="function">
    <dt>
    <a name = "compare"></a>
    <strong>compare (val1, val2, precision)</strong>
    </dt>
    <dd>
    compare two numbers with variable precision


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">val1</span>



        </li>
        <li><span class="parameter">val2</span>



        </li>
        <li><span class="parameter">precision</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "table_compare"></a>
    <strong>table_compare (t1, t2)</strong>
    </dt>
    <dd>
    quick'n'dirty table compare, compares values (not keys)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">t1</span>



        </li>
        <li><span class="parameter">t2</span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean, true if identical
    </ol>




</dd>
    <dt>
    <a name = "table_count"></a>
    <strong>table_count (t)</strong>
    </dt>
    <dd>
    count table entries, including mixed types


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">t</span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        int or nil
    </ol>




</dd>
    <dt>
    <a name = "table_find"></a>
    <strong>table_find (t, val)</strong>
    </dt>
    <dd>
    look for value within table


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">t</span>



        </li>
        <li><span class="parameter">val</span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean
    </ol>




</dd>
    <dt>
    <a name = "table_has_equal_values"></a>
    <strong>table_has_equal_values (t)</strong>
    </dt>
    <dd>
    check if values are the same
 (useful for detecting if a color is tinted)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">t</span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        boolean
    </ol>




</dd>
    <dt>
    <a name = "split_filename"></a>
    <strong>split_filename (filename)</strong>
    </dt>
    <dd>
    split_filename


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">filename</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "replace_char"></a>
    <strong>replace_char (pos, str, r)</strong>
    </dt>
    <dd>
    replace character in string


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">pos</span>



        </li>
        <li><span class="parameter">str</span>



        </li>
        <li><span class="parameter">r</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "note_pitch_to_value"></a>
    <strong>note_pitch_to_value (val)</strong>
    </dt>
    <dd>
    convert note-column pitch number into string value


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">val</span>

<ul>
    <li>NoteColumn note-value, e.g. 120</li>
</ul>

        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        nil or NoteColumn note-string, e.g. "OFF"
    </ol>




</dd>
    <dt>
    <a name = "value_to_midi_pitch"></a>
    <strong>value_to_midi_pitch (str_val)</strong>
    </dt>
    <dd>
    interpret note-string
 some examples of input: C#5  C--1  C-1 C#-1
 note that wildcard will return a fixed octave (1)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str_val</span>



        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        int
    </ol>




</dd>
    <dt>
    <a name = "extract_cc_num"></a>
    <strong>extract_cc_num (str_val)</strong>
    </dt>
    <dd>
    extract cc number from a parameter


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str_val</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "get_playing_pattern"></a>
    <strong>get_playing_pattern ()</strong>
    </dt>
    <dd>
    get<em>playing</em>pattern







</dd>
    <dt>
    <a name = "get_master_track"></a>
    <strong>get_master_track ()</strong>
    </dt>
    <dd>
    get<em>master</em>track







</dd>
    <dt>
    <a name = "get_master_track_index"></a>
    <strong>get_master_track_index ()</strong>
    </dt>
    <dd>
    get<em>master</em>track_index







</dd>
    <dt>
    <a name = "send_track"></a>
    <strong>send_track (send_index)</strong>
    </dt>
    <dd>
    get send track


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">send_index</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "get_color_average"></a>
    <strong>get_color_average (color)</strong>
    </dt>
    <dd>
    get average from color


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">color</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "is_monochrome"></a>
    <strong>is_monochrome (colorspace)</strong>
    </dt>
    <dd>
    check if colorspace is monochromatic


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">colorspace</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "strip_channel_info"></a>
    <strong>strip_channel_info (str)</strong>
    </dt>
    <dd>
    remove channel info from value-string


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "strip_note_info"></a>
    <strong>strip_note_info (str)</strong>
    </dt>
    <dd>
    remove note info from value-string


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "has_note_info"></a>
    <strong>has_note_info (str)</strong>
    </dt>
    <dd>
    remove note info from value-string


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "determine_track_type"></a>
    <strong>determine_track_type (track_index)</strong>
    </dt>
    <dd>
    get the type of track: sequencer/master/send


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">track_index</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "round_value"></a>
    <strong>round_value (num)</strong>
    </dt>
    <dd>
    round_value (from http://lua-users.org/wiki/SimpleRound)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">num</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "clamp_value"></a>
    <strong>clamp_value (value, min_value, max_value)</strong>
    </dt>
    <dd>
    clamp_value: ensure value is within min/max


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">value</span>



        </li>
        <li><span class="parameter">min_value</span>



        </li>
        <li><span class="parameter">max_value</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "wrap_value"></a>
    <strong>wrap_value (value, min_value, max_value)</strong>
    </dt>
    <dd>
    wrap_value: 'rotate' value within specified range
 (with a range of 0-127, a value of 150 will output 22


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">value</span>



        </li>
        <li><span class="parameter">min_value</span>



        </li>
        <li><span class="parameter">max_value</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "scale_value"></a>
    <strong>scale_value (value, in_min, in_max, out_min, out_max)</strong>
    </dt>
    <dd>
    scale_value: scale a value to a range within a range


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">value</span>
         (number) the value we wish to scale
        </li>
        <li><span class="parameter">in_min</span>
         (number)
        </li>
        <li><span class="parameter">in_max</span>
         (number)
        </li>
        <li><span class="parameter">out_min</span>
         (number)
        </li>
        <li><span class="parameter">out_max</span>
         (number)
        </li>
    </ul>

    <h3>Returns:</h3>
    <ol>

        number
    </ol>




</dd>
    <dt>
    <a name = "log_scale"></a>
    <strong>log_scale (ceiling, val)</strong>
    </dt>
    <dd>
    logarithmic scaling within a fixed space


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">ceiling</span>
         (number) the upper boundary
        </li>
        <li><span class="parameter">val</span>
         (number) the value to scale
        </li>
    </ul>





</dd>
    <dt>
    <a name = "inv_log_scale"></a>
    <strong>inv_log_scale (ceiling, val)</strong>
    </dt>
    <dd>
    inverse logarithmic scaling (exponential)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">ceiling</span>



        </li>
        <li><span class="parameter">val</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "fraction"></a>
    <strong>fraction (val)</strong>
    </dt>
    <dd>
    return the fractional part of a number


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">val</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "is_whole_number"></a>
    <strong>is_whole_number (n)</strong>
    </dt>
    <dd>
    check for whole number, using format()


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">n</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "sign"></a>
    <strong>sign (x)</strong>
    </dt>
    <dd>
    determine the sign of a number


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">x</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "average"></a>
    <strong>average (...)</strong>
    </dt>
    <dd>
    get average of supplied numbers


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">...</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "gcd"></a>
    <strong>gcd (m, n)</strong>
    </dt>
    <dd>
    greatest common divisor


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">m</span>



        </li>
        <li><span class="parameter">n</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "lcm"></a>
    <strong>lcm (m, n)</strong>
    </dt>
    <dd>
    least common multiplier (2 args)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">m</span>



        </li>
        <li><span class="parameter">n</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "least_common"></a>
    <strong>least_common (t)</strong>
    </dt>
    <dd>
    find least common multiplier


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">t</span>
         (table), use values in table as argument
        </li>
    </ul>





</dd>
    <dt>
    <a name = "TRACE"></a>
    <strong>TRACE (vararg)</strong>
    </dt>
    <dd>
    TRACE impl


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">vararg</span>
        )
        </li>
    </ul>





</dd>
    <dt>
    <a name = "LOG"></a>
    <strong>LOG (str)</strong>
    </dt>
    <dd>
    call this to avoid using "print" statements in source code


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "LOG_FILE"></a>
    <strong>LOG_FILE (str)</strong>
    </dt>
    <dd>
    append text to log.txt in the tool's root folder
 (warning: this is slow! only use when examining startup sequence,
 before it is possible to view output in the console window)


    <h3>Parameters:</h3>
    <ul>
        <li><span class="parameter">str</span>



        </li>
    </ul>





</dd>
</dl>
    <h2><a name="Tables"></a>Tables</h2>
    <dl class="function">
    <dt>
    <a name = "ORIENTATION"></a>
    <strong>ORIENTATION</strong>
    </dt>
    <dd>
    (Enum) used for layout purposes


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">VERTICAL</span>



        </li>
        <li><span class="parameter">HORIZONTAL</span>



        </li>
        <li><span class="parameter">NONE</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "NOTE_ARRAY"></a>
    <strong>NOTE_ARRAY</strong>
    </dt>
    <dd>
    Table of note names


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">C-</span>



        </li>
        <li><span class="parameter">C#</span>



        </li>
        <li><span class="parameter">D-</span>



        </li>
        <li><span class="parameter">D#</span>



        </li>
        <li><span class="parameter">E-</span>



        </li>
        <li><span class="parameter">F-</span>



        </li>
        <li><span class="parameter">F#</span>



        </li>
        <li><span class="parameter">G-</span>



        </li>
        <li><span class="parameter">G#</span>



        </li>
        <li><span class="parameter">A-</span>



        </li>
        <li><span class="parameter">A#</span>



        </li>
        <li><span class="parameter">B-</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DEVICE_PROTOCOL"></a>
    <strong>DEVICE_PROTOCOL</strong>
    </dt>
    <dd>
    (Enum)


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">OSC</span>



        </li>
        <li><span class="parameter">MIDI</span>



        </li>
    </ul>





</dd>
    <dt>
    <a name = "DEVICE_MESSAGE"></a>
    <strong>DEVICE_MESSAGE</strong>
    </dt>
    <dd>
    (Enum)


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">OSC</span>
        Osc Message
        </li>
        <li><span class="parameter">MIDI_CC</span>
        Midi CC Message
        </li>
        <li><span class="parameter">MIDI_NOTE</span>
        Midi Note Message
        </li>
        <li><span class="parameter">MIDI_PITCH_BEND</span>
        Midi Pitch Bend Message
        </li>
        <li><span class="parameter">MIDI_CHANNEL_PRESSURE</span>
        Midi Channel Pressure
        </li>
        <li><span class="parameter">MIDI_KEY</span>
        Midi Note Message (unspecific)
        </li>
        <li><span class="parameter">MIDI_PROGRAM_CHANGE</span>
        Midi Program Change Event
        </li>
        <li><span class="parameter">MIDI_NRPN</span>
        Midi Non-Registered Parameter Number
        </li>
    </ul>





</dd>
    <dt>
    <a name = "DEVICE_EVENT"></a>
    <strong>DEVICE_EVENT</strong>
    </dt>
    <dd>
    (Enum) the type of event (pressed, held etc.)


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">BUTTON_PRESSED</span>
        button event
        </li>
        <li><span class="parameter">BUTTON_RELEASED</span>
        button event
        </li>
        <li><span class="parameter">BUTTON_HELD</span>
        button event
        </li>
        <li><span class="parameter">VALUE_CHANGED</span>
        slider, encoder event
        </li>
        <li><span class="parameter">KEY_PRESSED</span>
        key event
        </li>
        <li><span class="parameter">KEY_RELEASED</span>
        key event
        </li>
        <li><span class="parameter">KEY_HELD</span>
        key event
        </li>
        <li><span class="parameter">PITCH_CHANGED</span>
        key event
        </li>
        <li><span class="parameter">CHANNEL_PRESSURE</span>
        key event
        </li>
    </ul>





</dd>
    <dt>
    <a name = "PARAM_MODE"></a>
    <strong>PARAM_MODE</strong>
    </dt>
    <dd>
    (Enum) valid <code>mode</code> attributes for <Param> nodes


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">abs</span>
        absolute value (the default, will accept floating point values)
        </li>
        <li><span class="parameter">abs_7</span>
        7 bit absolute value (quantize to 7 bit range before output)
        </li>
        <li><span class="parameter">abs_14</span>
        14 bit absolute value
        </li>
        <li><span class="parameter">rel_7_signed</span>
        7 bit relative signed value <br> -- Increase at [065 - 127], decrease at [001 - 063] <br>
        </li>
        <li><span class="parameter">rel_7_signed2</span>
        7 bit relative signed value <br> -- Increase at [001 - 063], decrease at [065 - 127] <br> -- <br>(known as "Relative 3" in the Behringer B-Control series)
        </li>
        <li><span class="parameter">rel_7_offset</span>
        7 bit relative value <br>        -- Increase at [065 - 127], decrease at [063 - 000] <br> -- (known as "Relative 2" in the Behringer B-Control series)
        </li>
        <li><span class="parameter">rel_7_twos_comp</span>
        7 bit relative value <br>        -- Increase at [001 - 64],  decrease at [127 - 065] <br> -- (known as "Relative 1" in the Behringer B-Control series)
        </li>
        <li><span class="parameter">rel_14_msb</span>
        14 bit relative value <br>       -- CC increase at [0x01 - 0x7F] when MSB is 0x00, decrease at [0x7F - 0x01] when MSB is 0x7F <br> -- NRPN increase at [0x01 - 0x7F] when MSB is 0x00, decrease at [0x01 - 0x7F] when MSB is 0x40 <br> -- (known as "Relative 1" in the Behringer B-Control series)
        </li>
        <li><span class="parameter">rel_14_offset</span>
        14 bit relative value <br>       -- CC increase at [0x01 - 0x7F] when MSB is 0x40, decrease at [0x7F - 0x01] when MSB is 0x3F <br> -- NRPN increase at [0x01 - 0x7F] when MSB is 0x40, decrease at [0x7F - 0x00] when MSB is 0x3F <br> -- (known as "Relative 2" in the Behringer B-Control series)
        </li>
        <li><span class="parameter">rel_14_twos_comp</span>
        14 bit relative value <br>       -- CC increase at [0x01 - 0x7F] when MSB is 0x00, decrease at [0x01 - 0x7F] when MSB is 0x40 <br> -- NRPN increase at [0x01 - 0x7F] when MSB is 0x00, decrease at [0x7F - 0x00] when MSB is 0x7F <br> -- (known as "Relative 3" in the Behringer B-Control series)
        </li>
    </ul>





</dd>
    <dt>
    <a name = "INPUT_TYPE"></a>
    <strong>INPUT_TYPE</strong>
    </dt>
    <dd>
    (Enum) valid <a href="http://www.lua.org/manual/5.1/manual.html#pdf-type">type</a>  attributes for <Param> nodes


    <h3>Fields:</h3>
    <ul>
        <li><span class="parameter">button</span>
        standard bidirectional button which output a value on press &amp; release, but does not control it's internal state
        </li>
        <li><span class="parameter">togglebutton</span>
        bidirectional button which toggles the state internally - this type of control does not support release &amp; hold events (examples are buttons on the BCF/BCR controller)
        </li>
        <li><span class="parameter">pushbutton</span>
        bidirectional button which will output values on press &amp; release while controlling it's state internally. Some examples are Automap "momentary" buttons, or TouchOSC pushbuttons
        </li>
        <li><span class="parameter">fader</span>
        manual fader
        </li>
        <li><span class="parameter">dial</span>
        basic rotary encoder
        </li>
        <li><span class="parameter">xypad</span>
        XY pad
        </li>
        <li><span class="parameter">keyboard</span>
        keyboard
        </li>
        <li><span class="parameter">key</span>
        key (drum-pad)
        </li>
        <li><span class="parameter">label</span>
        text display
        </li>
    </ul>





</dd>
</dl>
    <h2><a name="Fields"></a>Fields</h2>
    <dl class="function">
    <dt>
    <a name = "MODULE_PATH"></a>
    <strong>MODULE_PATH</strong>
    </dt>
    <dd>
    The main folder







</dd>
    <dt>
    <a name = "LOWER_NOTE"></a>
    <strong>LOWER_NOTE</strong>
    </dt>
    <dd>
    Lowest possible note







</dd>
    <dt>
    <a name = "UPPER_NOTE"></a>
    <strong>UPPER_NOTE</strong>
    </dt>
    <dd>
    Highest possible note







</dd>
    <dt>
    <a name = "RENOISE_DECIBEL"></a>
    <strong>RENOISE_DECIBEL</strong>
    </dt>
    <dd>
    Decibel constant







</dd>
</dl>


</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>
